
#include "system.h"

System::System()
{
	if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0)
	{
		throw SDL_GetError();

	}

	mScreen = SDL_SetVideoMode(800, 600, 32, SDL_HWSURFACE);

	mActors = new collections::Ind0Chain(false);
}

System::~System()
{
	delete mActors;
	SDL_Quit();
}

void System::mainLoop()
{
	SDL_Event evt;

	//while mActors.begin() != mActors.end()
	//(Actor*)(*mActors.begin()++)->

	bool quit = false; // quit event fired

	while(!quit)
	{
		SDL_PollEvent(&evt);
		switch(evt.type)
		{
		case SDL_QUIT   : quit=true;              break;
		case SDL_KEYDOWN: processKbEvt(&evt.key); break;
		case SDL_KEYUP  : processKbEvt(&evt.key); break;

		}

		SDL_PumpEvents();
	}
}

void System::processKbEvt(SDL_KeyboardEvent* evt)
{

}